<?php
  if (isset($product['Product']) and ($product['Product']))
      {
      foreach ($product['Product'] as $key => $value)
          {
          //echo $key.'<br>';
          if (isset($product['Product']['' . $key . '']) and ($product['Product']['' . $key . '']))
              {
              $product['Product']['' . $key . ''] = $product['Product']['' . $key . ''];
              }
          else
              {
              $product['Product']['' . $key . ''] = "";
              }
          }
      }
  if (isset($product['MasterProduct']) and ($product['MasterProduct']))
      {
      foreach ($product['MasterProduct'] as $key => $value)
          {
          if (isset($product['MasterProduct']['' . $key . '']) and ($product['MasterProduct']['' . $key . '']))
              {
              $product['MasterProduct']['' . $key . ''] = $product['MasterProduct']['' . $key . ''];
              }
          else
              {
              $product['MasterProduct']['' . $key . ''] = "";
              }
          }
      }
?>
<script type="text/javascript">
            $(function() {
              $('#add_prod').tabs({ fxSlide: false, fxFade: false, fxSpeed: 'normal' });
            });
        </script>
<style>
.mws-form select {
	padding:0px;
}
#ProductAttribute {
	border: 1px solid #CCCCCC;
	height: 30px;
	padding: 0 5px;
	width: 250px;
	float: left;
	margin-right: 10px;
}
#ProductAttrValue {
	border: 1px solid #CCCCCC;
	height: 30px;
	padding: 0 5px;
	width: 100px;
	margin-bottom: 10px;
}
.acc_form_1.form_width_27 {
	width:26%;
}
.acc_form_2.form_width_70 {
	width:70%;
}
#fragment-14 .acc_form_1 {
	width:33%;
}
#fragment-14 .acc_form_2 {
	width:63%;
}
</style>
<script>
jQuery(document).ready(function(){
		$('#chrcount').keyup(function(){
			var len = jQuery('#chrcount').val();
			var char = len.length;	
			if(254-char == 0){
				}
			$('#chrcountlength').html(255-char);	
		});
	});
	
	jQuery(document).ready(function(){
		
		$('#ProductOptionId').change(function(){
			var val = $(this).attr('value');
			var dataString = 'val='+val;
				$.ajax
					({
						type: "POST",
						url: "<?php
  echo $website_url . 'sellers/get_option_values';
?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
						   $('#Prooption').html(html);
						}
					});
			});
			
			$('#ProductGroupattribute').change(function(){
			var val = $(this).attr('value');
			var dataString = 'val='+val;
				$.ajax
					({
						type: "POST",
						url: "<?php
  echo $website_url . 'sellers/get_attributes_values';
?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
						   $('.appenddiv').html('&nbsp;');
						   $('#ajaxAttr').html(html);
						}
					});
			});
		
		
		$('#ProductCatId').change(function(){
			var val = $(this).attr('value');
			var dataString = 'cat_id='+val;
			var i=1;
			if(i==1)
			{
				$.ajax
					({
						type: "POST",
						url: "<?php
  echo $website_url . 'sellers/get_brands_values';
?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
						   $('#GetBrandsOnProductPage').html(html);
						    var i_1=2;
							if(i_1==2){
								$('.changeresultattr').html('&nbsp;');
								var dataString_2 = 'cat_id='+val;	
								$.ajax
									({
										type: "GET",
										url: "<?php
  echo $website_url . 'sellers/get_attributes_cat';
?>",
										data: dataString_2,
										cache: false,
										success: function(html)
										{
											$('.changeresultattr').html(html);
										}
									});
							}
						}
					});
			}
			
					
					
			});
		
		
		
		
		
			
		/*$('#ProductCatId').change(function(){
			var val = $(this).attr('value');
			var dataString = 'cat_id='+val;
				$.ajax
					({
						type: "POST",
						url: "<?php
  //echo $website_url . 'admin/setups/get_brands_values';
?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
						   $('#GetBrandsOnProductPage').html(html);
						}
					});
			});*/
			
		$('#ProductCatIdadd').change(function(){
			var option = $(this).attr('value');
			var dataString = 'option='+option;
				$.ajax
					({
						type: "POST",
						url: "<?php
  echo $website_url . 'sellers/get_option_results';
?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
							//return false;
						   $('.optionresult').html(html);
						   $('.optionresultADDMore').show();
						}
					});
			});
			
			
			
			$('#UserPriceList0').click(function(){
					$('.priceoption').attr('disabled', 'disabled');
				});
			$('#UserPriceList1').click(function(){
					$('.priceoption').removeAttr('disabled');
			});	
		
		$('#chrcount2').keyup(function(){
			var len = jQuery('#chrcount2').val();
			var char = len.length;	
			if(254-char == 0){
				}
			$('#chrcountlength2').html(255-char);	
		});
		
		        var incrementVar = 0;

				jQuery('#addattr').click(function (){
							var newDate = new Date;
							var randomNum = newDate.getTime();
							var	apphtml = jQuery('.addattr').html().
							replace('<select name="data[Product][Attr][1][attribute]" class="ProductAttribute mws-textinput" id="ProductAttribute">',
							 '<select name="data[Product][Attr]['+randomNum+'][attribute]" class="ProductAttribute mws-textinput" id="ProductAttribute">').
							replace('<input name="data[Product][Attr][1][key]" value="" class="sd" type="hidden">',
							 '<input name="data[Product][Attr]['+randomNum+'][key]" value="" class="sd" type="hidden">')
							 .
							replace('<input name="data[Product][Attr][1][attr_value]" value="" class="mws-textinput" id="ProductAttrValue" type="text">',
							 '<input name="data[Product][Attr]['+randomNum+'][attr_value]" value="" class="mws-textinput" id="ProductAttrValue" type="text">');
							
							//console.log(apphtml);
							//return false;
							jQuery('.appenddiv').append("<div id='"+randomNum+"'></div> <div class='clear' style='clear:both;'></div>");
							jQuery('#'+randomNum).html(apphtml);
					});

		        jQuery('.ProductAttribute').change(function () {
				var newDate = new Date;
				var randomNum = newDate.getTime();
				var value = jQuery(this).attr('value');
				var id = $(this).parent().parent().attr('id', 'sdo'+randomNum+'3');
				var str = "";
				jQuery("select.ProductAttribute option:selected").each(function () {
				str = $(this).text();
				});
				jQuery('#sdo'+randomNum+'3 input[type="hidden"]').attr('value', str);
		});	
		var month = 2;
		$('#optionresultADDMore').click(function(){
			var newDate = new Date;
			var randomNum = newDate.getTime();
			var randomNum_top = 'rand'+randomNum;
			var interoptionhtml = $('#oattr_5').attr('value');
			month+=1;
			var inc_month = month+1;
$('#optionaddmorevalues').append('<div id='+randomNum+' class="optionval"><table><tr id="option-value-row'+randomNum+'"><td width="188" class="right"><input type="text" name="data[Product][option]['+randomNum+'][option_value]['+month+']" class="priceoption"></td><td width="188" class="right"><input type="text" name="data[Product][option]['+randomNum+'][option_value]['+inc_month+']" class="priceoption"></td><td width="121" class="right"><input type="hidden" name="data[Product][option]['+randomNum+'][value_name]" value="'+interoptionhtml+'" size="23"><input type="text" name="data[Product][option]['+randomNum+'][qty]"></td><td width="62" class="left"><select name="data[Product][option]['+randomNum+'][subtract_stock]"><option value="1" selected="selected">Yes</option><option value="0">No</option></select></td><td width="114" class="right"><input type="text" name="data[Product][option]['+randomNum+'][price]" class="priceoption"></td><td width="55" class="left"><a onClick=$("#option-value-row'+randomNum+'").remove();" class="button"><strong>Remove</strong></a></td></tr><table></div> <div class="clear" style="clear:both;"></div>');
		});
		
		
		
		$('#addbrand').click(function(){
		/*$('#add_new').append('<input type="text" id="brandnewname" required="1" class="mws-textinput" placeholder="Brand Name" name="data[Brand][name]"><a id="remove" class="blue_link" href="javascript:void(0);"> &nbsp;Remove</a>');
		$(this).remove();*/
		var name_ = $(this).html();
		$('#add_new').toggle();
		if(name_=='Remove')
		{
			$('#brandnewname').attr('value', ''); 
			$('#brandnewname').removeAttr('required'); 
			$('#addbrand').html('Add More');
		}
		else
		{
			$('#brandnewname').attr('required','1'); 
			$('#addbrand').html('Remove');
		}
		
		});
		
		
		$('#LockBrand').click(function(){
			var val = $('#brandnewname').attr('value');	
			var dataString = 'brand_name='+val;
				$.ajax
					({
						type: "POST",
						url: "<?php
  echo $website_url . 'sellers/get_brand_lock';
?>",
						data: dataString,
						cache: false,
						success: function(html)
						{
							if(html!='NO')
								{
									alert('Brand name already existed with '+html+' name.choose it');
									$('#brandnewname').attr('value', ''); 
									$('#brandnewname').removeAttr('required'); 
									$('#addbrand').html('Add More');
									return false;
								}
						}
					});
		});
	});
</script>
<div class="mid_extra_top"> </div>
<h2 class="main_title">Add Product</h2>
<div class="def_width_100 text_def_13">Search our catalog for the product you want to sell and save yourself some time.</div>
<div class="width_74 f_left">
     <?php
  echo $this->element('Seller_Product_search');
?>
</div>
<div class="def_width_100 f_left">
     <div class="width_20 f_left">
          <h2 class="left_title">Listing Assistant</h2>
          <div class="sellerMain_gary">Supply enough information to make the buying decision easy. Please ensure that all products and content comply with our Selling policies and restrictions including the Restricted Products policy.
               
               required-attribute fields are required </div>
     </div>
     <?php
  echo $form->create(array(
      'action' => '',
      'method' => 'post',
      'enctype' => 'multipart/form-data',
      'class' => 'mws-form'
  ));
?>
     <div class="width_79 f_right"> 
          <!--*************************************-->
          <div class="def_width_100 f_left add_prod">
               <ul>
                    <li><a href="#fragment-13"><span>Vital Info</span></a></li>
                    <li><a href="#fragment-14"><span>Offer</span></a></li>
                    <li><a href="#fragment-15"><span>Images</span></a></li>
                    <li><a href="#fragment-16"><span>Description</span></a></li>
                    <li><a href="#fragment-17"><span>Keywords</span></a></li>
                    <!--<li><a href="#fragment-18"><span>More Details</span></a></li>-->
               </ul>
               <div id="fragment-13">
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Product Name <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <?php
  echo $this->Form->input('Product.id', array(
      'type' => 'hidden',
      'value' => $product['Product']['id'],
      'class' => 'mws-textinput',
      'label' => false
  ));
?>
                              <?php
  echo $this->Form->input('Product.name', array(
      'type' => 'text',
      'value' => $product['Product']['name'],
      'class' => 'mws-textinput',
      'required' => true,
      'label' => false
  ));
?>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Manufacturer <span class="redstar">*</span> : </div>
                         <div class="acc_form_2">
                              <?php
  echo $this->Form->input('Product.manufacturer', array(
      'type' => 'text',
      'value' => $product['Product']['manufacturer'],
      'class' => 'mws-textinput',
      'required' => true,
      'label' => false
  ));
?>
                              <span class="gray_comment">Example: Sony, Kitchen Aid, Microsoft</span> </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Upc Number <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <?php
  echo $this->Form->input('Product.upc', array(
      'type' => 'text',
      'value' => $product['Product']['upc'],
      'class' => 'mws-textinput',
      'required' => true,
      'label' => false
  ));
?>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Category <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <?php
  /*echo $this->Form->input('Product.cat_id', 
  array('type' => 'select','options'=>$_list_categories,
  'default'=>"",'class'=>'select_count1','empty'=>false,'label' =>false)
  );*/
?>
                              <select id="ProductCatId" class="select_count1 mws-textinput"  required="required" name="data[Product][cat_id]">
                                   <?php
  foreach ($_list_categories as $_list_category)
      {
      if (isset($_list_category['subcatecategories']) and ($_list_category['subcatecategories']))
          {
          if ($_list_category['name']):
              echo "<optgroup label=" . $_list_category['name'] . ">";
              foreach ($_list_category['subcatecategories'] as $_list_category_sub)
                  {
                  if (isset($_list_category_sub['Category']['id']) and ($_list_category_sub['Category']['id'] == $product['Product']['cat_id']))
                      {
                      $selected = 'selected="selected"';
                      }
                  else
                      {
                      $selected = '';
                      }
                  echo "<option  " . $selected . " value=" . $_list_category_sub['Category']['id'] . ">" . $_list_category_sub['Category']['name'] . "</option>";
                  }
              echo "</optgroup>";
          endif;
          }
      }
?>
                              </select>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Styles <span class="redstar">*</span>: <span class="gray_comment">(Max. 50 characters)</span> </div>
                         <div class="acc_form_2">
                              <div class="mws-form-item small">
                                   <?php
  echo $this->Form->input('Product.dept_id', array(
      'type' => 'select',
      'options' => $_list_departments,
      'default' => $product['Product']['dept_id'],
      'class' => 'select_count1',
      'empty' => false,
      'required' => true,
      'label' => false
      
  ));
?>
                                   <span class="gray_comment">Example: Sonny Brook Hams</span> </div>
                         </div>
                         <div class="def_width_100 f_left">
                              <div class="acc_form_1">Brand <span class="redstar">*</span>:</div>
                              <div class="acc_form_2">
                                   <div id="GetBrandsOnProductPage">
                                        <?php
  echo $this->Form->input('Product.brand_id', array(
      'type' => 'select',
      'options' => $_list_brands,
      'default' => $product['Product']['brand_id'],
      'class' => 'select_count1',
      'empty' => false,
      'required' => true,
      'label' => false
  ));
  
?>
                                   </div>
                                   <div class="apendaddbrand"> <a href="javascript:void(0);" class="blue_link" id="addbrand"> &nbsp;Add New</a></div>
                                   <span class="gray_comment">Example: C-50</span> </div>
                         </div>
                         <div class="def_width_100 f_left">
                              <div class="acc_form_1"> </div>
                              <div class="acc_form_2">
                                   <div id="add_new" style="display:none;">
                                        <input type="text" name="data[Brand][name]" placeholder="Brand Name" class="mws-textinput" id="brandnewname">
                                        <a id="LockBrand" class="blue_link" href="javascript:void(0);">Lock</a> </div>
                              </div>
                         </div>
                    </div>
               </div>
               <div id="fragment-14">
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Seller SKU <span class="redstar">*</span>: <span class="gray_comment">(Unique Identifier. If you don't enter a SKU we'll create one for you.) </span> </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input name="data[MasterProduct][sku]"  required="required" value="<?php
  echo $product['MasterProduct']['sku'];
?>" class="mws-textinput" id="ProductName" type="text">
                                   <input name="data[MasterProduct][id]" value="<?php
  echo $product['MasterProduct']['id'];
?>" id="ProductName" type="hidden">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Condition: : </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
  echo $this->Form->input('MasterProduct.conditions', array(
      'type' => 'select',
      'options' => $list_pr_conditions,
      'default' => "" . $product['MasterProduct']['conditions'] . "",
      'class' => 'select_count1',
      'empty' => false,
      'label' => false
  ));
?>
                              </div>
                              <span class="gray_comment">Example: Sony, Kitchen Aid, Microsoft</span> </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Condition Note: : </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <textarea style="height: 58px; width: 257px; padding: 0;" name="data[MasterProduct][condition_note]" value="<?php
  echo $product['MasterProduct']['condition_note'];
?>">
			  <?php
  echo $product['MasterProduct']['condition_note'];
?></textarea>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Your price <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" required="required" class="mws-textinput" value="<?php
  echo $product['MasterProduct']['price'];
?>" name="data[MasterProduct][price]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Manufacturer's Suggested Retail Price <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName"  required="required" class="mws-textinput"
               value="<?php
  echo $product['Product']['msrp'];
?>" name="data[Product][msrp]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Sale price:: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" class="mws-textinput" value="<?php
  echo $product['MasterProduct']['sale_price'];
?>" name="data[MasterProduct][sale_price]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Sale start date: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" class="mws-textinput" value="<?php
  echo $product['MasterProduct']['available_from_date'];
?>" name="data[MasterProduct][available_from_date]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Sale end date: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" class="mws-textinput" value="<?php
  echo $product['MasterProduct']['available_to_date'];
?>" name="data[MasterProduct][available_to_date]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Quantity <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" required="required" class="mws-textinput" value="<?php
  echo $product['MasterProduct']['qty'];
?>" name="data[MasterProduct][qty]">
                              </div>
                         </div>
                    </div>
                    <!--<div class="def_width_100 f_left">
        <div class="acc_form_1">MIn Quantity To Sell:  </div>
        <div class="acc_form_2">
         <div class="input text"><input type="text" id="ProductName" class="mws-textinput" value="" name="data[MasterProduct][min_qty]"></div>           </div>  
         </div>-->
                    
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Handling time (in days) <span class="redstar">*</span>:</div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" required="required" class="mws-textinput" value="<?php
  echo $product['MasterProduct']['handle_time'];
?>" name="data[MasterProduct][handle_time]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Seller Warranty Description:</div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" class="mws-textinput" value="<?php
  echo $product['MasterProduct']['warranty'];
?>" name="data[MasterProduct][warranty]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Shipping Method: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
  $checked   = "";
  $checked_1 = "";
  $checked_3 = "";
  $checked_4 = "";
  if (isset($product['MasterProduct']['shipping_method']) and ($product['MasterProduct']['shipping_method'] == 'WSF'))
      {
      $checked = 'checked="checked"';
      }
  else if (isset($product['MasterProduct']['shipping_method']) and ($product['MasterProduct']['shipping_method'] == 'MSF'))
      {
      $checked_1 = 'checked="checked"';
      }
  else if (isset($product['MasterProduct']['shipping_method']) and ($product['MasterProduct']['shipping_method'] == 'Free'))
      {
      $checked_4 = 'checked="checked"';
      }
  else
      {
      $checked_3 = 'checked="checked"';
      }
?>
                                   <input name="data[MasterProduct][shipping_method]" <?php
  echo $checked;
  echo $checked_3;
?> value="MSF"  type="radio">
                                   Shipping Price Added for product&nbsp;<br>
                                   <input name="data[MasterProduct][shipping_method]" <?php
  echo $checked_4;
?> value="Free" type="radio">
                                   Free Shipping Your Product.&nbsp;<br>
                              </div>
                         </div>
                    </div>
                    <?php
  if (isset($product['MasterProduct']['id']) and ($product['MasterProduct']['id']))
      {
      //echo  $product['Product']['weight'];
      //exit;
?>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Dimentions: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" 
                        class="mws-textinput" value="<?php
      echo $product['Product']['dimentions'];
?>" name="data[Product][dimentions]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Weight <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="number" id="ProductName"  style="width:80px; float:left;" class="mws-textinput" value="
						<?php
      echo str_replace(" lb", "", $product['Product']['weight']);
?>" name="data[Product][weight]" required="required">
                                   <?php
      echo $this->Form->input('Product.weight_unit', array(
          'type' => 'select',
          'options' => array(
              'lb' => 'lb'
              /*,'kg'=>'kg','gram'=>'gram','oz'=>'oz'*/
          ),
          'default' => 'lb',
          'class' => 'mws-textinput',
          'empty' => false,
          'style' => '    border: 1px solid #CCCCCC;float:  margin-left:10px; left;height: 30px;width:60px;',
          'label' => false
      ));
?>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Taxable: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
      $options_tax = array(
          '9' => 'Taxable Goods',
          '10' => 'Downloadable Products'
      );
      echo $this->Form->input('Product.tax_type', array(
          'type' => 'select',
          'options' => $options_tax,
          'default' => $product['Product']['tax_type'],
          'class' => 'mws-textinput',
          'empty' => false,
          'label' => false
      ));
?>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Stock: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
      echo $this->Form->input('Product.stock', array(
          'type' => 'select',
          'options' => $list_stock_status,
          'default' => $product['Product']['stock'],
          'class' => 'mws-textinput',
          'empty' => false,
          'label' => false
      ));
?>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">
                              <label style="font-weight:bold;cursor:pointer;">Attributes :</label>
                         </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <div class="addattr">
                                        <div class="mws-form-row" style="float:left;">
                                             <div class="mws-form-item small">
                                                  <?php
      if (isset($Special_Specifications) and ($Special_Specifications))
          {
          //pr($Special_Specifications);
          //exit;
          echo "<div class='single_border_window'>";
          foreach ($Special_Specifications as $Special_ATTRGRP)
              {
?>
                                                  <div class="mws-form-row">
                                                       <div class="mws-form-item small">
                                                            <?php
              echo $this->Form->input('', array(
                  'type' => 'text',
                  'class' => 'mws-textinput',
                  'label' => false,
                  'id' => 'gb1',
                  'disabled' => 'disabled',
                  'value' => $Special_ATTRGRP['AttrGroup']['name']
              ));
?>
                                                            <?php
              echo $this->Form->input('Product.Groupattribute', array(
                  'type' => 'hidden',
                  'id' => 'gb2',
                  'class' => 'mws-textinput',
                  'label' => false,
                  'value' => $Special_ATTRGRP['AttrGroup']['id']
              ));
?>
                                                       </div>
                                                  </div>
                                                  <div class="clear" style=" clear:both;"></div>
                                                  <?php
              if (isset($Special_ATTRGRP['AttrGroup']['Attributes']) and ($Special_ATTRGRP['AttrGroup']['Attributes']))
                  {
?>
                                                  <div class="editable_addattr">
                                                       <div class="mws-form-row" style="width:100%;">
                                                            <div class="mws-form-item small">
                                                                 <div class="changeresultattr">
                                                                      <?php
                  foreach ($Special_ATTRGRP['AttrGroup']['Attributes'] as $arrbute)
                      {
                      if (isset($arrbute['Specifications']) and ($arrbute['Specifications']))
                          {
                          foreach ($arrbute['Specifications'] as $specification)
                              {
                              //pr($specification);
                              //exit;
                              
?>
                                                                      <div id="ATTR<?php
                              echo $specification['Specification']['id'];
?>">
                                                                           <div class="mws-form-row masterlabel">
                                                                                <label>Selected Attribute:</label>
                                                                                <div class="mws-form-item small">
                                                                                     <input type="text" readonly="readonly" 
								value="<?php
                              echo $specification['Specification']['key'];
?>" class="mws-textinput">
                                                                                     <input type="hidden" name="data[Product][Attr][<?php
                              echo $specification['Specification']['attr_id'];
?>][id]"
								 value="<?php
                              echo $specification['Specification']['id'];
?>" style="width:100px;">
                                                                                     <input type="hidden" name="data[Product][Attr][<?php
                              echo $specification['Specification']['attr_id'];
?>][attribute]"
								 value="<?php
                              echo $specification['Specification']['attr_id'];
?>" style="width:100px;">
                                                                                     <input type="hidden" name="data[Product][Attr][<?php
                              echo $specification['Specification']['attr_id'];
?>][key]" value="<?php
                              echo $specification['Specification']['key'];
?>" class="sd">
                                                                                </div>
                                                                           </div>
                                                                           <div class="mws-form-row masterlabel">
                                                                                <label>Attribute Value:</label>
                                                                                <div class="mws-form-item small">
                                                                                     <div class="input text">
                                                                                          <input type="text" 
								name="data[Product][Attr][<?php
                              echo $specification['Specification']['attr_id'];
?>][attr_value]"
								value="<?php
                              echo $specification['Specification']['value'];
?>" class="mws-textinput"
								id="ProductAttrValue" style="width:306px;">
                                                                                     </div>
                                                                                </div>
                                                                           </div>
                                                                      </div>
                                                                      <div style="clear:both;" class="clear"></div>
                                                                      <?php
                              }
                          }
                      }
?>
                                                                 </div>
                                                            </div>
                                                       </div>
                                                  </div>
                                                  <?php
                  }
?>
                                                  <div class='clear' style='clear:both;'></div>
                                                  <?php
              }
          echo "</div>";
          }
?>
                                             </div>
                                        </div>
                                   </div>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Select Group Attribute:</div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
      if (isset($product['Product']['Groupattribute']) and ($product['Product']['Groupattribute']))
          {
          $product['Product']['Groupattribute'] = $product['Product']['Groupattribute'];
          }
      else
          {
          $product['Product']['Groupattribute'] = '';
          }
      echo $this->Form->input('Product.Groupattribute', array(
          'type' => 'select',
          'options' => $attrGroups,
          'class' => 'ProductAttribute mws-textinput',
          'default' => $product['Product']['Groupattribute'],
          'empty' => false,
          'label' => false,
          'style' => ' '
      ));
?>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">
                              <label style="font-weight:bold;cursor:pointer;">Attributes :</label>
                              <!--<label style="font-weight:bold;cursor:pointer;" class="addattrNow" id="addattr">Add More(+) :</label>--></div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <div class="addattr">
                                        <div class="mws-form-row" style="float:left;">
                                             <div class="mws-form-item small"> <span id="ajaxAttr">
                                                  <?php
      /*echo $this->Form->input('Product.attribute', array(
      'type' => 'select',
      'options' => $_list_attributes,
      'name' => 'data[Product][Attr][1][attribute]',
      'class' => 'ProductAttribute mws-textinput',
      'empty' => false,
      'label' => false,
      'style' => ''
      ));*/
?>
                                                  </span> 
                                                  <!--<input type="hidden" name="data[Product][Attr][1][key]" value="" class="sd" />--> 
                                             </div>
                                        </div>
                                        <!--<div class="mws-form-row" style="float:left;">
							<div class="mws-form-item small">
							  <?php
      /*echo $this->Form->input('Product.attr_value', array(
      'type' => 'text',
      'name' => 'data[Product][Attr][1][attr_value]',
      'value' => '',
      'class' => 'mws-textinput',
      'label' => false,
      'style' => ' '
      ));*/
?>
							</div>
						  </div>--> 
                                   </div>
                                   <!--<div class="appenddiv"> </div>--> 
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="optionresult" style="float:left;width: 80%;"> </div>
                         <div class="optionresultADDMore" style="display:none;float: left; "> <a href="javascript:void(0);" id="optionresultADDMore"><strong>Add More</strong></a> </div>
                         <div id="optionaddmorevalues" style="clear:both;"> </div>
                    </div>
                    <?php
      }
  else
      {
?>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Dimentions: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" class="mws-textinput" value="<?php
      echo $product['Product']['dimentions'];
?>" name="data[Product][dimentions]">
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Weight <span class="redstar">*</span>: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <input type="text" id="ProductName" style="width:80px; float:left; margin-right:10px;" class="mws-textinput" value="<?php
      echo $product['Product']['weight'];
?>" name="data[Product][weight]" required="required">
                                   <?php
      echo $this->Form->input('Product.weight_unit', array(
          'type' => 'select',
          'options' => array(
              'lb' => 'lb'
              /*'kg'=>'kg','gram'=>'gram','oz'=>'oz'*/
          ),
          'default' => 'lb',
          'class' => 'mws-textinput',
          'empty' => false,
          'style' => '    border: 1px solid #CCCCCC;float: left;height: 30px;width:45px;',
          'label' => false
      ));
?>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Taxable: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
      $options_tax = array(
          '9' => 'Taxable Goods',
          '10' => 'Downloadable Products'
      );
      echo $this->Form->input('Product.tax_type', array(
          'type' => 'select',
          'options' => $options_tax,
          'default' => $product['Product']['tax_type'],
          'class' => 'mws-textinput',
          'empty' => false,
          'label' => false
      ));
?>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Stock: </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
      echo $this->Form->input('Product.stock', array(
          'type' => 'select',
          'options' => $list_stock_status,
          'default' => $product['Product']['stock'],
          'class' => 'mws-textinput',
          'empty' => false,
          'label' => false
      ));
?>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">
                              <label style="font-weight:bold;cursor:pointer;">Attributes :</label>
                         </div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <div class="addattr_1">
                                        <div style="float:left;" class="mws-form-row">
                                             <div class="mws-form-item small">
                                                  <div class="changeresultattr"> PLease select a category first</div>
                                             </div>
                                        </div>
                                   </div>
                              </div>
                         </div>
                    </div>
                    <!--<div class="def_width_100 f_left">
                         <div class="acc_form_1">Select Group Attribute:</div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <?php
     /* if (isset($product['Product']['Groupattribute']) and ($product['Product']['Groupattribute']))
          {
          $product['Product']['Groupattribute'] = $product['Product']['Groupattribute'];
          }
      else
          {
          $product['Product']['Groupattribute'] = '';
          }
      echo $this->Form->input('Product.Groupattribute', array(
          'type' => 'select',
          'options' => $attrGroups,
          'class' => 'ProductAttribute mws-textinput',
          'default' => $product['Product']['Groupattribute'],
          'empty' => true,
          'label' => false,
          'style' => ' '
      ));*/
?>
                              </div>
                         </div>
                    </div>-->
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">
                             <!-- <label style="font-weight:bold;cursor:pointer;">Attributes :</label>-->
                              <!--<label style="font-weight:bold;cursor:pointer;" class="addattrNow" id="addattr">Add More(+) :</label>--></div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <div class="addattr">
                                        <div class="mws-form-row" style="float:left;">
                                             <div class="mws-form-item small"> <span id="ajaxAttr">
                                                  <?php
      /*echo $this->Form->input('Product.attribute', array(
      'type' => 'select',
      'options' => $_list_attributes,
      'name' => 'data[Product][Attr][1][attribute]',
      'class' => 'ProductAttribute mws-textinput',
      'empty' => false,
      'label' => false,
      'style' => ''
      ));*/
?>
                                                  </span> 
                                                  <!--<input type="hidden" name="data[Product][Attr][1][key]" value="" class="sd" />--> 
                                             </div>
                                        </div>
                                        <!--<div class="mws-form-row" style="float:left;">
							<div class="mws-form-item small">
							  <?php
      /*echo $this->Form->input('Product.attr_value', array(
      'type' => 'text',
      'name' => 'data[Product][Attr][1][attr_value]',
      'value' => '',
      'class' => 'mws-textinput',
      'label' => false,
      'style' => ' '
      ));*/
?>
							</div>
						  </div>--> 
                                   </div>
                                   <!--<div class="appenddiv"> </div>--> 
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1">Option Type</div>
                         <div class="acc_form_2">
                              <div class="input text">
                                   <div class="mws-form-row">
                                        <div class="mws-form-item small">
                                             <?php
      echo $this->Form->input('Product.option_id', array(
          'type' => 'select',
          'options' => $list_options,
          'name' => 'data[Product][option][option_str]',
          'default' => '4',
          'class' => 'ProductAttribute mws-textinput',
          'empty' => false,
          'id' => 'ProductCatIdadd',
          'label' => false
      ));
?>
                                        </div>
                                   </div>
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="optionresult" style="float:left;width: 80%;"> </div>
                         <div class="optionresultADDMore" style="display:none;float: left; "> <a href="javascript:void(0);" id="optionresultADDMore"><strong>Add More</strong></a> </div>
                         <div id="optionaddmorevalues" style="clear:both;"> </div>
                    </div>
                    <?php
      }
?>
               </div>
               <div id="fragment-15">
                    <div class="def_width_100 f_left">
                         <?php
  
  $rel_images     = $product['Product']['rel_img'];
  $rel_images_exp = explode(', ', $rel_images);
  if (isset($rel_images_exp[0]) and ($rel_images_exp[0]))
      {
      $height = "";
      
      }
  else
      {
      $height = "";
      }
  
  if (isset($product['Product']['img']) and ($product['Product']['img']))
      {
      echo $html->image('Product/' . $product['Product']['img'], array(
          'height' => $height,
          'width' => '371',
          'class' => 'variable_image item-3 drop-shadow"',
          'alt' => ""
      ));
      }
?>
                         <?php
  if (isset($rel_images_exp[0]) and ($rel_images_exp[0]))
      {
      echo '<div class="thumbs">';
      foreach ($rel_images_exp as $rel_imag)
          {
          echo $html->image('Product/' . $product['Product']['id'] . '/' . $rel_imag, array(
              'width' => '90',
              'height' => '83'
          ));
          }
      echo '</div>';
      }
  
  echo $this->Form->input('Product.imgImage', array(
      'type' => 'file',
      'value' => '',
      'class' => '',
      'label' => false
  ));
?>
                    </div>
                    <div class="mws-form-row" style="float:left; width:180px;"> <br />
                         <label style="font-weight:bold; font-size:16px;">Related Images:</label>
                         <div class="mws-form-item 	small">
                              <?php
  echo $this->Form->input('Product.RelatedimgImage', array(
      'type' => 'file',
      'max' => '5',
      'name' => 'data[Product][multi][]',
      'multiple' => 'multiple',
      'label' => false
  ));
?>
                         </div>
                    </div>
               </div>
               <div id="fragment-16">
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1 form_width_27">Description <span class="redstar">*</span></div>
                         <div class="acc_form_2 form_width_70">
                              <div class="input text">
                                   <?php
  echo $this->Form->input('Product.description', array(
      'type' => 'teatarea',
      'rows' => '5',
      'cols' => '44',
      'value' => $product['Product']['description'],
      'class' => 'mws-textinput',
      'required' => true,
      'label' => false
  ));
?>
                                   <script type="text/javascript">
				var editor = CKEDITOR.replace( 'ProductDescription' );
				CKFinder.setupCKEditor( editor, { basePath : '<?php
  echo $website_url;
?>app/webroot/ckfinder' } ) ;  </script> 
                                   </script> 
                              </div>
                         </div>
                    </div>
               </div>
               <div id="fragment-17">
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1 form_width_27"> Meta Keywords </div>
                         <div class="acc_form_2 form_width_70">
                              <div class="input text">
                                   <?php
  echo $this->Form->input('Product.meta_key', array(
      'type' => 'teatarea',
      'value' => $product['Product']['meta_key'],
      'rows' => '5',
      'cols' => '44',
      'class' => 'mws-textinput',
      'label' => false
  ));
?>
                                   <script type="text/javascript">
				var editor = CKEDITOR.replace( 'ProductMetaKey' );
				CKFinder.setupCKEditor( editor, { basePath : '<?php
  echo $website_url;
?>app/webroot/ckfinder' } ) ;  </script> 
                                   </script> 
                              </div>
                         </div>
                    </div>
                    <div class="def_width_100 f_left">
                         <div class="acc_form_1 form_width_27">Meta Description </div>
                         <div class="acc_form_2 form_width_70">
                              <div class="input text">
                                   <?php
  echo $this->Form->input('Product.meta_desc', array(
      'type' => 'teatarea',
      'value' => $product['Product']['meta_desc'],
      'rows' => '5',
      'cols' => '44',
      'class' => 'mws-textinput',
      'label' => false
  ));
?>
                                   <script type="text/javascript">
				var editor = CKEDITOR.replace( 'ProductMetaDesc' );
				CKFinder.setupCKEditor( editor, { basePath : '<?php
  echo $website_url;
?>app/webroot/ckfinder' } ) ;  </script> 
                                   </script> 
                              </div>
                         </div>
                    </div>
               </div>
               <!--<div id="fragment-18"> </div>-->
          </div>
     </div>
     <div class="def_width_100 f_left ">
          <div class="pad_10"></div>
          <div class="width_60 f_right">
               <input name="" type="submit" value="submit" class="form_btn"/>
          </div>
     </div>
     <!--************************************--> 
</div>
</form>
